#include "bflb_mtimer.h"
#include "bflb_i2c.h"
#include "board.h"
#include "oled.h"
#include "bflb_gpio.h"

struct bflb_device_s *i2c0;

int main(void)
{
    struct bflb_device_s* gpio;
    board_init();
    //board_i2c0_gpio_init();
    

    gpio = bflb_device_get_by_name("gpio");
    /* I2C0_SCL */
    bflb_gpio_init(gpio, GPIO_PIN_0, GPIO_FUNC_I2C0 | GPIO_ALTERNATE | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_1);
    /* I2C0_SDA */
    bflb_gpio_init(gpio, GPIO_PIN_1, GPIO_FUNC_I2C0 | GPIO_ALTERNATE | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_1);
    i2c0 = bflb_device_get_by_name("i2c0");

    bflb_i2c_init(i2c0, 400000);
    OLED_Init();
    OLED_clr();
    //OLED_show_bmp();
    OLED_ShowCHinese(39,0,0);
    OLED_ShowCHinese(55,0,1);
    OLED_ShowCHinese(71,0,2);

    OLED_ShowCHinese(39,2,0);//此处是第2行，因为汉字是16*16
    OLED_ShowCHinese(55,2,1);
    OLED_ShowCHinese(71,2,2);

    OLED_ShowCHinese(39,4,0);
    OLED_ShowCHinese(55,4,1);
    OLED_ShowCHinese(71,4,2);

    OLED_ShowCHinese(39,6,0);
    OLED_ShowCHinese(55,6,1);
    OLED_ShowCHinese(71,6,2);
    printf("end\r\n");

    while(1){
    }
}
